arr = [["g","b","a"],["c","e"],["d","f"]] |
1 | arr = [["g","b","a"],["c","e"],["d","f"]] |
for x in range(3): |
print(testing[x][1]) |
testing = [[4,2,3],[3,3,2],[1,2,3]] |
for x in range(3): |
    print(testing[x][1]) |
testing = [[4,2,3],[3,3,2],[1,2,3]] |
1 | testing = [[4,2,3],[3,3,2],[1,2,3]] |
2 | for x in range(3): |
3 |     print(testing[x][1]) |
4 |      |
testing = [[4,2,3],[3,3,2],[1,2,3]] |
for x in range(3): |
print(testing[0][x]) |
testing = [[4,2,3],[3,3,2],[1,2,3]] |
for x in range(3): |
    print(testing[0][x]) |
1 | testing = [[4,2,3],[3,3,2],[1,2,3]] |
2 | for x in range(3): |
3 |     print(testing[0][x]) |
for x in range(3): |
testing = [[4,2,3],[3,3,2],[1,2,3]] |
print(testing[x][2]) |
for x in range(3): |
testing = [[4,2,3],[3,3,2],[1,2,3]] |
    print(testing[x][2]) |
1 | testing = [[4,2,3],[3,3,2],[1,2,3]] |
2 | for x in range(3): |
3 |     print(testing[x][2]) |
for x in range(5): |
testing = [[4,2,3,5,6],[3,3,2,2,1],[1,2,3,2,2],[5,2,1,5,4]] |
print(testing[2][x]) |
for x in range(5): |
testing = [[4,2,3,5,6],[3,3,2,2,1],[1,2,3,2,2],[5,2,1,5,4]] |
    print(testing[2][x]) |
1 | testing = [[4,2,3,5,6],[3,3,2,2,1],[1,2,3,2,2],[5,2,1,5,4]] |
2 | for x in range(5): |
3 |     print(testing[2][x]) |
total = total + scores[x][1] |
scores = [[17,45,9],[22,15,33],[12,45,6]] |
print(total) |
for x in range(3): |
total = 0 |
    total = total + scores[x][1] |
scores = [[17,45,9],[22,15,33],[12,45,6]] |
print(total) |
for x in range(3): |
total = 0 |
1 | scores = [[17,45,9],[22,15,33],[12,45,6]] |
2 | total = 0 |
3 | for x in range(3): |
4 |     total = total + scores[x][1] |
5 | print(total) |
passrate = [["Computer Science", 80],["History",70],["Geography",67], ["Maths",74],["English",64]] |
for x in range(len(passrate)): |
print("Pass rate for each subject") |
print(passrate[x][0] + ": " + str(passrate[x][1]) + "%") |
passrate = [["Computer Science", 80],["History",70],["Geography",67], ["Maths",74],["English",64]] |
for x in range(len(passrate)): |
print("Pass rate for each subject") |
    print(passrate[x][0] + ": " + str(passrate[x][1]) + "%") |
1 | passrate = [["Computer Science", 80],["History",70],["Geography",67], ["Maths",74],["English",64]] |
2 | print("Pass rate for each subject") |
3 | for x in range(len(passrate)): |
4 |     print(passrate[x][0] + ": " + str(passrate[x][1]) + "%") |
5 |      |
testing = [[4,2],[3,2],[1,3]] |
for x in range(3): |
print(testing[x][0] + testing[x][1]) |
testing = [[4,2],[3,2],[1,3]] |
for x in range(3): |
    print(testing[x][0] + testing[x][1]) |
1 | testing = [[4,2],[3,2],[1,3]] |
2 | for x in range(3): |
3 |     print(testing[x][0] + testing[x][1]) |
total = 0 |
total = total + arr[0][x] |
for x in range(3): |
print(total) |
arr = [[0,4,6],[0,3,4],[0,1,3]] |
total = 0 |
    total = total + arr[0][x] |
for x in range(3): |
print(total) |
arr = [[0,4,6],[0,3,4],[0,1,3]] |
1 | arr = [[0,4,6],[0,3,4],[0,1,3]] |
2 | total = 0 |
3 | for x in range(3): |
4 |     total = total + arr[0][x] |
5 | print(total) |
for x in range(3): |
total = 0 |
print(total) |
total = total + arr[x][0] |
arr = [[0,4,6],[0,3,4],[0,1,3]] |
for x in range(3): |
total = 0 |
print(total) |
    total = total + arr[x][0] |
arr = [[0,4,6],[0,3,4],[0,1,3]] |
1 | arr = [[0,4,6],[0,3,4],[0,1,3]] |
2 | total = 0 |
3 | for x in range(3): |
4 |     total = total + arr[x][0] |
5 | print(total) |
for x in range(3): |
for y in range(3): |
arr[y][x] = arr[y][x] * 2 |
arr = [[0,4,6],[0,3,4],[0,1,3]] |
print(arr) |
    for x in range(3): |
for y in range(3): |
        arr[y][x] = arr[y][x] * 2 |
arr = [[0,4,6],[0,3,4],[0,1,3]] |
print(arr) |
1 | arr = [[0,4,6],[0,3,4],[0,1,3]] |
2 | for y in range(3): |
3 |     for x in range(3): |
4 |         arr[y][x] = arr[y][x] * 2 |
5 | print(arr) |
total = total + price |
price = shopping[x][1] |
print("Total: £" + str(total)) |
print(name + ": £" + str(price)) |
for x in range(len(shopping)): |
total = 0 |
name = shopping[x][0].title() |
shopping = [["apple",5.99],["bread",3.99],["avocado",1.99]] |
    total = total + price |
    price = shopping[x][1] |
print("Total: £" + str(total)) |
    print(name + ": £" + str(price)) |
for x in range(len(shopping)): |
total = 0 |
    name = shopping[x][0].title() |
shopping = [["apple",5.99],["bread",3.99],["avocado",1.99]] |
1 | shopping = [["apple",5.99],["bread",3.99],["avocado",1.99]] |
2 | total = 0 |
3 | for x in range(len(shopping)): |
4 |     name = shopping[x][0].title() |
5 |     price = shopping[x][1] |
6 |     print(name + ": £" + str(price)) |
7 |     total = total + price |
8 | print("Total: £" + str(total)) |
print(leaderboard[x][0] + " wins!") |
for x in range(len(leaderboard)): |
if leaderboard[x][1] > 50: |
break |
leaderboard = [['coolgamer87', 42],['foodie_lover', 30],['musicjunkie22', 48],['travel_bug', 15],['bookworm24', 52],['fitnessfreak', 20],['techgeek', 28],['naturelover', 45],['artistic_soul', 60],['fashionista', 50]] |
        print(leaderboard[x][0] + " wins!") |
for x in range(len(leaderboard)): |
    if leaderboard[x][1] > 50: |
        break |
leaderboard = [['coolgamer87', 42],['foodie_lover', 30],['musicjunkie22', 48],['travel_bug', 15],['bookworm24', 52],['fitnessfreak', 20],['techgeek', 28],['naturelover', 45],['artistic_soul', 60],['fashionista', 50]] |
1 | leaderboard = [['coolgamer87', 42],['foodie_lover', 30],['musicjunkie22', 48],['travel_bug', 15],['bookworm24', 52],['fitnessfreak', 20],['techgeek', 28],['naturelover', 45],['artistic_soul', 60],['fashionista', 50]] |
2 | for x in range(len(leaderboard)): |
3 |     if leaderboard[x][1] > 50: |
4 |         print(leaderboard[x][0] + " wins!") |
5 |         break |
print(max) |
for y in range(len(arr[x])): |
for x in range(len(arr)): |
max = arr[0][0] |
if arr[x][y] > max: |
max = arr[x][y] |
arr = [[0,4,6],[0,3,4],[0,1,3]] |
print(max) |
    for y in range(len(arr[x])): |
for x in range(len(arr)): |
max = arr[0][0] |
        if arr[x][y] > max: |
            max = arr[x][y] |
arr = [[0,4,6],[0,3,4],[0,1,3]] |
1 | arr = [[0,4,6],[0,3,4],[0,1,3]] |
2 | max = arr[0][0] |
3 | for x in range(len(arr)): |
4 |     for y in range(len(arr[x])): |
5 |         if arr[x][y] > max: |
6 |             max = arr[x][y] |
7 | print(max) |
idx = 0 |
max = arr[0][0] |
for x in range(len(arr)): |
print(idx) |
idx = 0 |
for y in range(len(arr[x])): |
arr = [[0,4,6],[0,3,4],[0,1,3]] |
if arr[x][y] > max: |
max = arr[x][y] |
            idx = 0 |
max = arr[0][0] |
for x in range(len(arr)): |
print(idx) |
idx = 0 |
    for y in range(len(arr[x])): |
arr = [[0,4,6],[0,3,4],[0,1,3]] |
        if arr[x][y] > max: |
            max = arr[x][y] |
1 | arr = [[0,4,6],[0,3,4],[0,1,3]] |
2 | max = arr[0][0] |
3 | idx = 0 |
4 | for x in range(len(arr)): |
5 |     for y in range(len(arr[x])): |
6 |         if arr[x][y] > max: |
7 |             max = arr[x][y] |
8 |             idx = 0 |
9 | print(idx) |
i = input() |
arr = [["A",80],["B",67],["C",54],["D",47],["E",35],["F",0]] |
break |
print("Grade:" + arr[x][0]) |
for x in range(len(arr)): |
i = int(i) |
print("Enter a test score") |
if i >= arr[x][1]: |
i = input() |
arr = [["A",80],["B",67],["C",54],["D",47],["E",35],["F",0]] |
        break |
        print("Grade:" + arr[x][0]) |
for x in range(len(arr)): |
i = int(i) |
print("Enter a test score") |
    if i >= arr[x][1]: |
1 | arr = [["A",80],["B",67],["C",54],["D",47],["E",35],["F",0]] |
2 | print("Enter a test score") |
3 | i = input() |
4 | i = int(i) |
5 | for x in range(len(arr)): |
6 |     if i >= arr[x][1]: |
7 |         print("Grade:" + arr[x][0]) |
8 |         break |
9 |          |
arr = [[0,4,6],[0,3,4],[0,1,3]] |
e = "" |
for x in range(3): |
for y in range(3): |
print(e) |
e = e + str(arr[x][y]) + " " |
arr = [[0,4,6],[0,3,4],[0,1,3]] |
    e = "" |
for x in range(3): |
    for y in range(3): |
    print(e) |
        e = e + str(arr[x][y]) + " " |
1 | arr = [[0,4,6],[0,3,4],[0,1,3]] |
2 | for x in range(3): |
3 |     e = "" |
4 |     for y in range(3): |
5 |         e = e + str(arr[x][y]) + " " |
6 |     print(e) |
7 |
e = e + str(arr[y][x]) + " " |
print(e) |
e = "" |
arr = [[0,4,6],[0,3,4],[0,1,3]] |
for y in range(3): |
for x in range(3): |
        e = e + str(arr[y][x]) + " " |
    print(e) |
    e = "" |
arr = [[0,4,6],[0,3,4],[0,1,3]] |
    for y in range(3): |
for x in range(3): |
1 | arr = [[0,4,6],[0,3,4],[0,1,3]] |
2 | for x in range(3): |
3 |     e = "" |
4 |     for y in range(3): |
5 |         e = e + str(arr[y][x]) + " " |
6 |     print(e) |
7 |      |
avg = round(avg,2) |
arr = [["Emma",1,6,1,2,2,1], ["Jessica",1,5,3,4,1,5], ["Harry",5,4,1,2,1,0]] |
avg = avg/(l-1) |
l = len(arr[x]) |
for x in range(len(arr)): |
print("Average: " + str(avg)) |
avg = 0 |
for y in range(1,l): |
print(arr[x][0]) |
avg = avg + arr[x][y] |
    avg = round(avg,2) |
arr = [["Emma",1,6,1,2,2,1], ["Jessica",1,5,3,4,1,5], ["Harry",5,4,1,2,1,0]] |
    avg = avg/(l-1) |
    l = len(arr[x]) |
for x in range(len(arr)): |
    print("Average: " + str(avg)) |
    avg = 0 |
    for y in range(1,l): |
    print(arr[x][0]) |
        avg = avg + arr[x][y] |
1 | arr = [["Emma",1,6,1,2,2,1], ["Jessica",1,5,3,4,1,5], ["Harry",5,4,1,2,1,0]] |
2 | for x in range(len(arr)): |
3 |     print(arr[x][0]) |
4 |     l = len(arr[x]) |
5 |     avg = 0 |
6 |     for y in range(1,l): |
7 |         avg = avg + arr[x][y] |
8 |     avg = avg/(l-1) |
9 |     avg = round(avg,2) |
10 |     print("Average: " + str(avg)) |
index = start |
while True: |
print(grades[index][0]) |
grades = [["Ben",2],["Amanda",0],["Charles",3],["Dennis",5],["Freddy",6],["Edgar",4],["George",-1]] |
start = 1 |
index = grades[index][1] |
break |
if index == -1: |
index = start |
while True: |
    print(grades[index][0]) |
grades = [["Ben",2],["Amanda",0],["Charles",3],["Dennis",5],["Freddy",6],["Edgar",4],["George",-1]] |
start = 1 |
    index = grades[index][1] |
        break |
    if index == -1: |
1 | grades = [["Ben",2],["Amanda",0],["Charles",3],["Dennis",5],["Freddy",6],["Edgar",4],["George",-1]] |
2 | start = 1 |
3 | |
4 | index = start |
5 | while True: |
6 |     print(grades[index][0]) |
7 |     index = grades[index][1] |
8 |     if index == -1: |
9 |         break |
10 |